package com.dsz.usercenter.once;

import com.dsz.usercenter.mapper.UserMapper;
import com.dsz.usercenter.model.domain.User;
import org.springframework.stereotype.Component;

import javax.annotation.Resource;
import java.util.Date;

@Component
public class ImportTestData {
    @Resource
    private UserMapper userMapper;
//    @Scheduled(initialDelay = 3000, fixedDelay = Long.MAX_VALUE)
    public void importUsers() {
        for (int i = 0; i < 10; i++) {
            User user = new User();
            user.setUsername("嘟嘟嘟");
            user.setUserAccount("dushangzhi");
            user.setAvatarUrl("https://tse1-mm.cn.bing.net/th/id/OIP-C.gZ-F-gt9t2MXOA0dY-qbSAAAAA?rs=1&pid=ImgDetMain");
            user.setGender(0);
            user.setUserPassword("b0dd3697a192885d7c055db46155b26a");
            user.setEmail("xxx.com");
            user.setUserStatus(0);
            user.setPhone("112331223123");
            user.setPlanetCode("1111");
            user.setCreateTime(new Date());
            user.setUpdateTime(new Date());
            user.setIsDelete(0);
            user.setUserRole(0);
            user.setTags("[\"emo\",\"想家\"]");
            user.setProfile("想要每天开心");
            userMapper.insert(user);
        }
    }
}
